package com.cgw.game.adapter;

import android.graphics.Color;

import androidx.annotation.Nullable;

import com.cgw.game.R;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;
import java.util.Random;

public class DemoAdapter extends BaseQuickAdapter<String,BaseViewHolder> {
    @Override
    protected void convert(BaseViewHolder helper, String item) {
        helper.setText(R.id.value,item);
        helper.setTextColor(R.id.value,randomColor());
    }

    public DemoAdapter(@Nullable List<String> data) {
        super(R.layout.demo_item,data);
    }

    public int randomColor() {
        Random random = new Random();
        int r = random.nextInt(256);
        int g = random.nextInt(256);
        int b = random.nextInt(256);
        return Color.rgb(r, g, b);
    }
}
